import React from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { addAction,subAction,addAction2 } from '../store/modules/countStore'

export default function CountRedux() {
  const {count} = useSelector(state => state.count)
  const dispatch = useDispatch()
  return (
    <div>
      <h1>CountRedux</h1>
      {count} 
      <button onClick={() => dispatch(addAction())}>+</button>
      <button onClick={() => dispatch(subAction())}>-</button>
      <button onClick={() => dispatch(addAction2(100))}>+100</button>
    </div>
  )
}
